<style>
.calendar-div{
    overflow: auto;
    height: 600px;
}
</style>

<?php

//cargar javascript propio de esta vista
$this->load->view("horario/disponibilidad_js");

//funciones auxiliares

function openCalendar(){
    $dias = array('Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo');
    echo "<table class='table table-bordered table-striped responsive-utilities'>";
    echo "<thead><tr>";
    echo "<th>Hora</th>";//echo "<th style='width:190px'>Hora</th>";
    $i = 0;
    foreach ($dias as $dia){
        echo "<th id='cell-th-$i'>$dia</th>";
        $i ++;
    }
    echo "</tr></thead>";
}

function closeCalendar(){
    echo "</table>";
}

function calendarRow($row, $dk){

    $hIni = substr("00".$row, -2).":00";
    $hFin = substr("00".($row+1), -2).":00";

    echo "<tr>";
    echo "<th>"."$hIni - $hFin"."</th>";

    for ($k=0; $k<7; $k++){
        echo "<td id='cell-".$row."-".($k+$dk)."' class='is-hidden'>"."</td>";
    }
    echo "</tr>";
}

?>


<div class='calendar-div'>
        <?php
        openCalendar();
            $hIni = 0;
            for ($i=0; $i<24; $i++){
                $row = ($i+$hIni)%24;
                if ($i+$hIni >= 24){
                    $dk = 1;
                }else{
                    $dk = 0;
                }
                calendarRow($row, $dk);
            }
        closeCalendar();
        ?>
        </div>
    </div>

</div>